﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace Mian.Model;

public partial class ChatManangerContext : DbContext
{
    public ChatManangerContext()
    {
    }

    public ChatManangerContext(DbContextOptions<ChatManangerContext> options)
        : base(options)
    {
    }

    public virtual DbSet<ChatUser> ChatUsers { get; set; }

    public virtual DbSet<MiniOpenidBind> MiniOpenidBinds { get; set; }

    public virtual DbSet<VerifyCode> VerifyCodes { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
        => optionsBuilder.UseSqlServer("Server=47.98.220.224;Database=ChatMananger;User Id=PengSiQi;Password=Psq2000..;Encrypt=True;TrustServerCertificate=True;");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<ChatUser>(entity =>
        {
            entity.HasKey(e => e.Uid).HasName("PK__ChatUser__DD7012640021BCCE");

            entity.Property(e => e.Uid).HasComment("用户id");
            entity.Property(e => e.Brithday).HasComment("生日");
            entity.Property(e => e.CreateTime).HasComment("创建时间");
            entity.Property(e => e.Gender).HasComment("性别");
            entity.Property(e => e.Ip).HasComment("ip地址");
            entity.Property(e => e.LevelId).HasComment("等级");
            entity.Property(e => e.Nick).HasComment("用户昵称");
            entity.Property(e => e.OnlineStatus).HasComment("在线状态");
            entity.Property(e => e.Phone)
                .IsFixedLength()
                .HasComment("用户电话");
            entity.Property(e => e.SignaTure).HasComment("个性签名");
            entity.Property(e => e.Status).HasComment("状态");
        });

        modelBuilder.Entity<MiniOpenidBind>(entity =>
        {
            entity.HasKey(e => e.Oid).HasName("PK__MiniOpen__C2FFCF1347483C67");

            entity.Property(e => e.Oid).HasComment("主键");
            entity.Property(e => e.BindTime).HasComment("绑定事件");
            entity.Property(e => e.OpenId).HasComment("小程序openid");
            entity.Property(e => e.Phone)
                .IsFixedLength()
                .HasComment("用户电话");
            entity.Property(e => e.Uid).HasComment("用户id");
        });

        modelBuilder.Entity<VerifyCode>(entity =>
        {
            entity.HasKey(e => e.Vid).HasName("PK__VerifyCo__C5F0B443F8BF693B");

            entity.Property(e => e.Vid).HasComment("验证码id");
            entity.Property(e => e.Code)
                .IsFixedLength()
                .HasComment("验证码");
            entity.Property(e => e.ExpiredTime).HasComment("过期时间");
            entity.Property(e => e.Phone)
                .IsFixedLength()
                .HasComment("电话");
            entity.Property(e => e.SendTime).HasComment("发送时间");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
